<template>
    <u-tabs class="bg-white mb-2" :list="list" @click="clickTab"></u-tabs>
    <view class="content bg-white">
        <u-parse :content="agreementData.content"></u-parse>
    </view>
</template>

<script setup lang="ts">
import { reactive } from "vue";
import { agreementConfig } from "@/api/other";

const agreementData = reactive({
    type: 1,
    content: "",
});

const list = reactive([
    { name: "服务协议", type: 1 },
    { name: "隐私协议", type: 2 },
]);

const clickTab = (value) => {
    agreementData.type = value.type;
    getData();
};

const getData = async () => {
    const res = await agreementConfig({ type: agreementData.type });
    agreementData.type = res.type;
    agreementData.content = res.content;
};

getData();
</script>

<style lang="scss" scoped>
.content {
    padding: 0 20rpx;
}
</style>
